#include<bits/stdc++.h>

using namespace std;

/**
 * 大整数乘法c=a*b 多项式乘法
 * @param a
 * @param b
 * @param c
 */
void mul(vector<int> a, vector<int> b, vector<int> &c) {
    c.resize(a.size() + b.size());
    for (int i = 0; i < a.size(); i++)
        for (int j = 0; j < b.size(); j++) {
            //a[i] *10^i * b[j]*10^j=a[i]*b[j]* 10^(i+j)
            c[i + j] += a[i] * b[j];

        }
    int cs = 0;
    for (int i = 0; i < c.size(); i++) {
        int temp = c[i] + cs;
        c[i] = temp % 10;
        cs = temp / 10;
    }
}

int main() {
    cout << 1111111 * 1111111 << endl;
    vector<int> a(11, 1); //9321
    vector<int> b(11, 1); //789
    vector<int> c;
    mul(a, b, c);

    copy(c.rbegin(), c.rend(), ostream_iterator<int>(cout, ""));

    return 0;
}
